<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('选择经理')" />
</head>
<body class="gray-bg">
<div class="container-div">
    <input type="hidden" id="manu_code" th:value="${manu_code}">
    <div class="row">
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<div th:include="include :: footer"></div>
<script th:inline="javascript">
    $(function() {
        var options = {
            url: ctx + "gears_info/gears_info/getAll",
            showSearch: false,
            showRefresh: false,
            showToggle: false,
            showColumns: false,
            queryParams:queryParams,
            clickToSelect:true,
            columns: [{
                radio: true
            },
                {
                    field : 'MANU_NUM',
                    title : '终端编号',
                },
                {
                    field : 'MODEL',
                    title : '终端型号'
                },
                {
                    field : 'TYPE',
                    title : '终端类型',
                    formatter:function (value, row, index) {
                        if (value == '0'){
                            return "传统POS";
                        }else if (value == '1'){
                            return "MPOS";
                        }else if (value == '2'){
                            return "智能POS";
                        }else if (value == '3'){
                            return "机构";
                        }else if (value == '4'){
                            return "电签POS";
                        }
                        return $.table.tooltip(value,5);
                    }
                },

            ]
        };
        $.table.init(options);
    });

    //查询参数
    function queryParams(params) {
        var search = $.table.queryParams(params);
        search.manu_code = $("#manu_code").val();
        return search;
    }

    /* 添加用户-选择用户-提交 */
    function submitHandler(index, layero) {
        var model = $.table.selectColumns("MODEL");
        var manu_num = $.table.selectColumns("MANU_NUM");
        if (manu_num.length == 0) {
            $.modal.alertWarning("请至少选择一条记录");
            return;
        }
        $.modal.close();
       //修改父页面值
        parent.$("#model").val(model);
        parent.$("#zdId").val(manu_num);
    }
</script>
</body>
</html>